package utility;

public class Replacesspace 
{
	public static String replacesspace(String message)
	{
		try
		{
			char doublequto='"';
			char msg[] =message.toCharArray();
			String Result="";
			String substring="";
			for(int i=0;i<msg.length;i++)
			{	
				if(msg[i]==doublequto)
				{	
					do
					{
						if(i==msg.length) break;
						substring = substring + Character.toString(msg[i]);
						i++;
					}while(msg[i]!=doublequto);
					substring = substring + Character.toString(msg[i]);
					Result = Result +substring ;
					substring ="";
				}
				else  if(msg[i]!=' ')
				 Result = Result + Character.toString(msg[i]);	
			}
			return(Result);
		}
		catch (Exception e) 
		{
		return "ERROR";
		}
	}
	
	public static void main(String[] args) 
	{
	  Replacesspace rs = new Replacesspace();
	  System.out.print(rs.replacesspace("11 master     \"   \"   add *   \"m  ah      endra\" #6      0 5"));
	}
}
